package com.ll.menu.user.history.list;

import com.droid.library.app.mvp.recycler.BaseRecyclerPresenter;
import com.ll.menu.user.app.entity.Order;

import java.util.ArrayList;

/**
 * 订单历史列表
 *
 * @author wangheng
 */

public class OrderHistoryListPresenter extends BaseRecyclerPresenter<IOrderHistoryListUI> {
    @Override
    protected void requestList(int page, int pageSize) {
        if(isUIDestroyed()){
            return;
        }
        ArrayList<Order> list = new ArrayList<>();
        for(int i = 0;i < 20;i++){
            Order order = new Order();
            String d = String.valueOf(i + 1);
            if(i + 1 < 10){
                d = "0" + (i + 1);
            }
            order.setDate("2018-04-" + d);
            order.setId(String.valueOf(i + 1));
            list.add(order);
        }


        if(getUI().getAdapter() != null){
            getUI().getAdapter().resetDataList(list);
            onRefreshCompleted(PAGE_FIRST,true,true);

        }
    }
}
